
import {Table}from 'antd'
import axios from 'axios'
import { useEffect, useState } from 'react';
function Zong() {
  const [data,setdata]=useState([])
  const [zmd,setzmd]=useState('')

 



  useEffect(()=>{


 const fetdata=    setInterval(
      ()=>{ axios.get("http://node.dayuan0307.top:300/zhihui/query/").then(
        (res)=>{
          console.log(res.data)
          setdata(res.data)
        const sourdata = res.data
         for(let key in sourdata){
          console.log(sourdata[key].status)
         const destatus = sourdata[key].status
         console.log(typeof(destatus))

         }
        }
      ).catch(
  
        (err)=>{
          console.log(err)
        }
      )},3000
    )

    return ()=>{
      clearInterval(fetdata)
    }






  })
  const columns = [
    {
      title: 'id',
      dataIndex: 'id',
      key: 'id',
    },
    {
      title: '姓名',
      dataIndex: 'name',
      key: 'name',
    },
    {
        title: '开机时间',
        dataIndex: 'startup',
        key: 'startup',
      },
    {
      title: '节点状态',
      dataIndex: 'status',
      key: 'status',
    },
    {
      title: '最有一次提交数据',
      dataIndex: 'time',
      key: 'time',
    },
    
    
  ];
  return (
    <div>

      <h1>智慧大哥节点业主情况</h1>
   
      <div>
<Table columns ={columns } dataSource={data}  ></Table>
      </div>
    </div>
  );
}

export default Zong;
